package com.szm.business.action;

import com.szm.business.util.ActionConstant;
import com.szm.business.util.SysConstant;
import com.szm.mvc.action.base.ActionSupport;

/**
 * @author szm
 * @ClassName LoginAction.java
 * @Description 登录Action
 *				自动注入属性,String
 */
public class LoginAction extends ActionSupport{
	
	/**
	 * name .
	 */
	private String name;
	/**
	 * password .
	 */
	private String password;
	
	/* 跳转至登录界面
	 * @see com.szm.mvc.action.base.ActionSupport#execute()
	 */
	@Override
	public String execute() throws Exception {
		// TODO Auto-generated method stub
		return ActionConstant.LOGIN;
	}
	
	/**
	 * @author szm
	 * @Description 用户登录
	 * @return
	 */
	public String login(){
		//模拟业务逻辑
		if("szm".equals(name) && "123456".equals(password)){
			System.out.println(SysConstant.SYS_INFO+"成功，跳转个人主页");
			return ActionConstant.MAIN;
		}else{
			System.out.println(SysConstant.SYS_FAIL+"失败，返回登录页面");
			return ActionConstant.LOGIN;
		}
	}
	
	/**
	 * @author szm
	 * @Description 用户退出
	 * @return
	 */
	public String loginOut(){
		System.out.println(SysConstant.SYS_INFO+"退出，跳转登录页面");
		return ActionConstant.LOGINOUT;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	
}
